/**
 * @Author:周邱艳
 * @Date:20200615
 * @Describle:这是组合详情页
 */

import React, { Component } from "react";
import {Card, Col, Row} from "antd";
import axios from "axios";
import {URL} from '../../../index'
let data=""
export default class PortfolioDetailTop extends Component{
    //返回柱状图的配置对象
    constructor(props) {
        super(props);
        this.getCategorys=this.getCategorys.bind(this)

    }
    getCategorys() {
        //数据请求
        axios({
            method:"GET",
            url:URL+"/combinationDynamicInfo/combinationDetailData",
            params:{comBaseId:this.props.portfolioId}
        }).then(
            (res) => {
                //状态码判断
                if(res.data.code===200){
                    data = res.data
                    this.setState({})
                    //状态码判断
                }else if(res.data.code === 500){
                    this.props.history.push('/serverError')
                }
            }
        ).catch(function (error) {//异常处理
            console.log(error);
        })
    }
    //组件挂载后
    componentDidMount() {
        this.getCategorys()
    }
    //数据渲染
    render() {

        return(
            <div>
                <Row gutter={16} >
                    <Col span={2}></Col>
                    <Col span={4}>
                        <Card title="组合名字" bordered={false} style={{ width: 200,fontSize:30,color:"red",textAlign:"center"}}>
                            {data.comBaseName}
                        </Card>
                    </Col>
                    <Col span={4}>
                        <Card title="交易数量(次数)" bordered={false} style={{ width: 200,fontSize:30,color:"red",textAlign:"center" }}>
                            {data.transactionNum}
                        </Card>
                    </Col>
                    <Col span={4}>
                        <Card title="访问数量(人数)" bordered={false} style={{ width: 200,fontSize:30,color:"red",textAlign:"center" }}>
                            {data.visitNum}
                        </Card>
                    </Col>
                    <Col span={4}>
                        <Card title="收藏数量(次数)" bordered={false} style={{ width: 200,fontSize:30,color:"red",textAlign:"center" }}>
                            {data.collectNum}
                        </Card>
                    </Col>
                    <Col span={4}>
                        <Card title="购买数量(次数)" bordered={false} style={{ width: 200,fontSize:30,color:"red" ,textAlign:"center"}}>
                            {data.purchaseNum}
                        </Card>
                    </Col>
                </Row>
            </div>
        )
    }
}
